<template>
  <div>
    <loading v-if="isLoading"></loading>
    <router-view></router-view>
  </div>
</template>

<script>
//  import axios from 'axios'
// //直接拿数据渲染
//  import './mock/test/mockjs.js'
import { mapState } from "vuex";
import loading from "./components/loading/loading";
export default {
  data() {
    return {}
  },
  methods: {},
  mounted() {
    /*    axios.get('/user/userinfo').then((res) => {
      console.log(res)
    }) */
    //    axios.post('/api/v1/test2').then((res) => {
    //   console.log(res, '2')
    // })  
  },
  computed:{
    ...mapState(["isLoading"])
  },
  components:{loading},
  watch:{
    //做题  章节练习 跳转哪一题   监听
    "$route.path"(newVal,oldVal){
      //从章节模拟题退出
       if(newVal!=='/testPritise'&&oldVal==="/testPritise"){          
         this.$store.commit('homework/chapTerStateChage')      
       }    
    }
  }

}
</script>
<style scoped>
.loading {
 width: 100%;
 height: 100%;
 left: 0;
 top: 0;
 position: fixed;
 padding-top: 5.333333rem;
 z-index: 99999999;
}

</style>
